package com.xgpro.common.enums;

/**
 * @author tx
 * @version 1.0
 * @date 2019/8/24 12:58
 */
public enum ResultCodeEnum {

    //有需要，自己加上错误代码和信息即可
    ERROR("9999","系统维护中，请联系管理员"),
    SUCCESS("0000","请求成功"),
    NO_SESSION("10","没有登录"),
    NO_AGENTID("611","没有agentId"),
    //提交失败
    ADD_FAILE("11","请求提交失败"),
    //上传文件失败
    UPLOAD_FALE("12","上传文件失败"),
    //上传内容为空
    UPLOAD_ISEMPTY("13","上传内容为空"),
    //自自定义异常信息,code值不能重复,比如优才引荐可以从100起,学习中心200起,这样不容易乱
    NO_RECRUITMENT("100","没有更多的岗位信息"),
    //相关招聘已删除
    DE_RECRUITMENT("101","相关招聘已删除"),
    //邮件发送失败
    MAILE_FALE("102","简历发送失败"),
    //解除失败
    CANCLE_FALE("201","解除关系失败"),
    //评价失败
    EVA_FALE("202","评价失败"),
    //申请导师失败
    APPLAYTEA_FALE01("203","已有申请记录,请等候审批"),
    //申请导师失败
    APPLAYTEA_FALE02("204","已有导师，请勿再次申请"),
    //收徒上线
    ARRNUM_FALE("205","已达收徒上限"),
    APPLAYTEA_FALE03("209","该导师已拒绝您的请求"),
    APPLAYTEA_FALE04("210","请求已提交,请勿重新审批"),
    REMIND_FALE("206","该条课程已被审批"),
    FULL_STUDENT("207","培训人数已达上线,请期待下次培训机会"),
    HAD_SIGN("208","已经报过该课程"),
    CANCLE_FALE02("211","数据错误"),
    DET_INTRODUCE("1001","应聘信息已被删除"),
    ////参数异常（空值，格式错误）
    INCORRECTPARAM_CODE("14","请求参数有误或为空"),

    CAN_NOT_DELETE_ROLE("301","角色已被用户使用无法删除"),

    CAN_NO_TO_VIS("304","抱歉,您没有权限访问该页面"),
    CAN_NOT_DELETE_PERMISSIONS("302","权限已被角色使用无法删除"),
    CAN_NOT_LOGIN("303","您没有权限访问微应用"),
    MESSAGE_SEND_FAIL("401","消息发送失败"),
	
	INSUFFICIENT_YEARS("601","晋级年限不足"),

    APPLICATION_IN_PROGRESS("602","正在申请中"),

    INCOMPLETE_USER_INFORMATION("603","用户信息不全,请补全用户信息"),

    INCOMPLETE_PROMOTION_INFORMATION("604","序列或职级为空，请联系管理员!"),

    NOT_APPROVED("605","未审批,不可删除"),

    HIGHEST_RANK("606","职级信息有误或当前已是最高职级"),

    APPROVAL_FAIL("607","审批失败"),

    UPDATE_FAIL("608","更新信息失败"),
	
	DELETE_FAIL("609","删除信息失败"),

    ERROR_IN_ANALYSIS("610","解析的文件格式有误!"),
	
    PLAN_UPLOAD("2001","培训计划未上传"),

    FILE_UPLOAD("2002","文件未上传"),

    COURSE_FAILE_01("333","您并未参加该课程"),

    COURSE_FAILE_02("334","您已参加过该课程的评估"),

    COURSE_FAILE_03("335","您尚未参加该课程"),
    COURSE_FAILE_04("336","课程已被删除"),
    TEA_EVA_FAILE_01("337","该用户不是您的徒弟"),
    TEA_EVA_FAILE_02("338","该徒弟已评估,请勿重复评估"),
    TEA_EVA_FAILE_03("339","该用户不是您的导师"),
    FILE_FAILE_UPLOAD("400","文件格式错误"),
    FILE_FAILE_DownLoad("401","下载文件失败"),
    COURSE_PERMISSION_MISS("1111111","您没有权限审批,请联系管理员"),
    HAD_TEA("2222","该用户已为内部导师,请勿重复添加"),
    COURSE_ERROR("3333","该课程无人参加"),
    COURSE_EVA_ERROR("4444","该课程尚未有人评估"),
    EXCEL_ERROR("5555","表格导入失败"),
    EXCEL_EMPTY("6666","表格内容为空"),
    FULL_TEA("7777","讲师风采已满6位"),
    TEA_SELF("8888","请勿申请自己为导师");
    private String code;

    private String message;

    ResultCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getCode(String name){
        for (ResultCodeEnum item: ResultCodeEnum.values()){
            if (item.name().equals(name)){
                return item.code;
            }
        }
        return null;
   }

    public void setCode(String code) {
        this.code = code;
    }

    public static String getMessage(String name) {
        for (ResultCodeEnum item: ResultCodeEnum.values()){
            if (item.name().equals(name)){
                return item.message;
            }
        }
        return name;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
